package cn.gov.pbc.gd.credit.vo.center.query;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Map;

import com.liu.tools.StrUtil;

/**
 * @author liuxingmi
 * @datetime 2017年6月5日 上午11:44:28
 * @desc 个人代理征信查询第二步请求数据
 */
public class ReqSecondStepVo  implements Serializable{
	
	//querylog=yes&
	//queryreason=04&chargeNOHidden=&dissentid=&chargestathidden=&querytypehidden=24&querynumber=1&historychargestat=0
	//&name=%C1%F5%D0%CB%C3%DC&certtype=0&certno=412822198212021417&reltel=&relname=&relcerttype=&relcertno=&querytype=24
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1442159854364489519L;
	
	/**
	 * 业务查询id
	 */
	private String id;

	/**
	 * 查询日志
	 */
	private String querylog;
	
	/**
	 * 查询原因：04-个人查询，09-司法查询
	 */
	private String queryreason;
	
	private String chargeNOHidden;
	
	private String dissentid;
	
	private String chargestathidden;
	
	private String querytypehidden;
	
	/**
	 * 查询次数
	 */
	private Integer querynumber;
	
	private Integer historychargestat;

	/**
	 * 用户姓名
	 */
	private String name;
	
	/**
	 * 证件类型：0-身份证，1-户口簿，2-护照，3-军官证，4-士兵证，5-港澳居民来往内地通行证，6-台湾同胞来往内地通行证
	 *          7-临时身份证，8-外国人居留证，9-警官证，A-香港身份证&B-澳门身份证&C-台湾身份证&X-其它证件
	 */
	private String certtype;
	
	/**
	 * 证件号码
	 */
	private String certno;
	
	/**
	 * 代理人电话
	 */
	private String reltel;
	
	/**
	 * 代理人姓名
	 */
	private String relname;
	
	/**
	 * 代理人证件类型
	 */
	private String relcerttype;
	
	/**
	 * 代理人证件号码
	 */
	private String relcertno;
	
	/**
	 * 查询类型
	 */
	private String querytype;
	
	private Map<String, String> cookies;
	
	
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	public String getQuerylog() {
		return querylog;
	}

	public void setQuerylog(String querylog) {
		this.querylog = querylog;
	}

	public String getQueryreason() {
		return queryreason;
	}

	public void setQueryreason(String queryreason) {
		this.queryreason = queryreason;
	}

	public String getChargeNOHidden() {
		return chargeNOHidden;
	}

	public void setChargeNOHidden(String chargeNOHidden) {
		this.chargeNOHidden = chargeNOHidden;
	}

	public String getDissentid() {
		return dissentid;
	}

	public void setDissentid(String dissentid) {
		this.dissentid = dissentid;
	}

	public String getChargestathidden() {
		return chargestathidden;
	}

	public void setChargestathidden(String chargestathidden) {
		this.chargestathidden = chargestathidden;
	}

	public String getQuerytypehidden() {
		return querytypehidden;
	}

	public void setQuerytypehidden(String querytypehidden) {
		this.querytypehidden = querytypehidden;
	}

	public Integer getQuerynumber() {
		return querynumber;
	}

	public void setQuerynumber(Integer querynumber) {
		this.querynumber = querynumber;
	}

	public Integer getHistorychargestat() {
		return historychargestat;
	}

	public void setHistorychargestat(Integer historychargestat) {
		this.historychargestat = historychargestat;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCerttype() {
		return certtype;
	}

	public void setCerttype(String certtype) {
		this.certtype = certtype;
	}

	public String getCertno() {
		return certno;
	}

	public void setCertno(String certno) {
		this.certno = certno;
	}

	public String getReltel() {
		return reltel;
	}

	public void setReltel(String reltel) {
		this.reltel = reltel;
	}

	public String getRelname() {
		return relname;
	}

	public void setRelname(String relname) {
		this.relname = relname;
	}

	public String getRelcerttype() {
		return relcerttype;
	}

	public void setRelcerttype(String relcerttype) {
		this.relcerttype = relcerttype;
	}

	public String getRelcertno() {
		return relcertno;
	}

	public void setRelcertno(String relcertno) {
		this.relcertno = relcertno;
	}

	public String getQuerytype() {
		return querytype;
	}

	public void setQuerytype(String querytype) {
		this.querytype = querytype;
	}

	public Map<String, String> getCookies() {
		return cookies;
	}

	public void setCookies(Map<String, String> cookies) {
		this.cookies = cookies;
	}

	public String toParams() {
		
		try {

			StringBuilder builder = new StringBuilder();
			builder.append("querylog=");
			builder.append("yes");
			builder.append("&queryreason=");
			builder.append(queryreason);
			builder.append("&chargeNOHidden=");
			builder.append(chargeNOHidden);
			builder.append("&dissentid=");
			builder.append(dissentid);
			builder.append("&chargestathidden=");
			builder.append(chargestathidden);
			builder.append("&querytypehidden=");
			builder.append(querytypehidden);
			builder.append("&querynumber=");
			builder.append(querynumber);
			builder.append("&historychargestat=");
			builder.append(historychargestat);
			builder.append("&name=");
			builder.append(StrUtil.isNull(name) ? "" : URLEncoder.encode(name,"GBK"));
			builder.append("&certtype=");
			builder.append(certtype);
			builder.append("&certno=");
			builder.append(StrUtil.isNull(certno) ? "" : URLEncoder.encode(certno,"GBK"));
			builder.append("&reltel=");
			builder.append(reltel);
			builder.append("&relname=");
			builder.append(StrUtil.isNull(relname) ? "" : URLEncoder.encode(relname,"GBK"));
			builder.append("&relcerttype=");
			builder.append(relcerttype);
			builder.append("&relcertno=");
			builder.append(StrUtil.isNull(relcertno) ? "" : URLEncoder.encode(relcertno,"GBK"));
			builder.append("&querytype=");
			builder.append(querytype);
			return builder.toString().replaceAll("null", "");
			
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
			return "";
		}

	}

	
	
}
